package org.Niu.July7th.genericsTest;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Arrays;

public class sortTest {
    public static void main(String[] args) {
        Student[] class11 = new Student[]{
                new Student("张三",12,true),
                new Student("李四",11,true),
                new Student("王五",14,true)
        };
        Arrays.sort(class11);
        System.out.println(Arrays.toString(class11));
    }
}

@Data
@AllArgsConstructor
class Student implements Comparable<Student>{
    String name;
    Integer age;
    /**
     * 0:女 1:男
     */
    boolean sex;

    @Override
    public int compareTo(Student o) {
        // 升序
        return this.age - o.age;
    }
    // 7.3 编写泛型
}
